basedir=$(dirname "$0")

copy_img(){
  source=$1
  dest=$basedir"/static/images/resource/"${img##*/}
  cp $source $dest
  
  echo $dest
}

git_add(){
  cd $basedir
  file=$1
  comment=$2
  git add $1 > /dev/null
}
git_push(){
   git commit -m "add resources" > /dev/null
   git push origin master > /dev/null
}

for img in "$@"; do
  file=$(copy_img $img)
  git_add $file
  echo "https://gitee.com/amath0312/blog/raw/master/static/images/resource/"${file##*/}
done
git_push


